package com.balad.elements;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

public class SplashScreen extends Activity {

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		// Must be first instruction of onCreate.
		super.onCreate(savedInstanceState);
		// Show Splash screen.
		setContentView(R.layout.splash);
		// Create and run thread.
		
		
		Thread splashThread = new Thread() {
			
			
			/* (non-Javadoc)
			 * @see java.lang.Thread#run()
			 */
			@Override
			public void run() {
				try {
					int waited = 0;

					while (waited < 5000) {
						sleep(50);
						waited += 100;
					}
				} catch (InterruptedException e) {
					e.printStackTrace();
				} finally {
					finish();	
					
					// Start the activity "PeutateChaudeActivity" in the end of the thread
					Intent intent = new Intent(SplashScreen.this, ListeVillesBoutonActivity.class);
					startActivity(intent);
				}
			}
		};
		
		splashThread.start();
	}
}